import { IPSAppPFPluginRef } from './ipsapp-pfplugin-ref';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppPFPluginRefImpl extends PSModelObjectImpl implements IPSAppPFPluginRef {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端模板插件');
    }
    return value;
  }

  get pluginCode(): string {
    return this.M.pluginCode;
  }

  get pluginModel(): IModel {
    return this.M.pluginModel;
  }

  get pluginType():
    | 'AC_ITEM'
    | 'CHART_RENDER'
    | 'CHART_AXISRENDER'
    | 'CHART_SERIESRENDER'
    | 'CHART_CSRENDER'
    | 'CUSTOM'
    | 'DATAVIEW_ITEM'
    | 'DATAVIEW_RENDER'
    | 'EDITFORM_RENDER'
    | 'EDITOR_CUSTOMSTYLE'
    | 'FORM_USERCONTROL'
    | 'GRID_COLRENDER'
    | 'GRID_RENDER'
    | 'LIST_ITEMRENDER'
    | 'LIST_RENDER'
    | 'PORTLET_CUSTOM'
    | 'PORTLET_TITLEBAR'
    | 'SEARCHFORM_RENDER'
    | 'TOOLBAR_ITEM'
    | 'TOOLBAR_RENDER'
    | 'TREEEXPBAR_RENDER'
    | 'TREE_RENDER'
    | 'UIENGINE'
    | 'UILOGICNODE'
    | 'VIEW_CUSTOM'
    | 'DEMETHOD'
    | 'APPUTIL'
    | 'APPCOUNTER'
    | 'DEDATAIMPORT'
    | 'DEDATAEXPORT'
    | 'DEFVALUERULE'
    | 'APPVALUERULE'
    | 'SEARCHBAR_ITEM'
    | 'SEARCHBAR_RENDER'
    | 'WIZARDPANEL_RENDER'
    | 'DEUIACTION'
    | 'CALENDAR_ITEM'
    | 'CALENDAR_RENDER'
    | 'MAPVIEW_ITEM'
    | 'MAPVIEW_RENDER'
    | 'PANEL_ITEM'
    | 'PANEL_RENDER'
    | 'DASHBOARD_ITEM'
    | 'DASHBOARD_RENDER'
    | 'APPUILOGIC'
    | 'APPMENU_ITEM'
    | 'APPMENU_RENDER'
    | 'TITLEBAR_RENDER' {
    return this.M.pluginType;
  }

  get rTObjectName(): string {
    return this.M.rTObjectName;
  }

  get rTObjectRepo(): string {
    return this.M.rTObjectRepo;
  }

  get refMode(): string {
    return this.M.refMode;
  }

  get refTag(): string {
    return this.M.refTag;
  }

  get refTag2(): string {
    return this.M.refTag2;
  }

  get templCode(): string {
    return this.M.templCode;
  }

  get templCode2(): string {
    return this.M.templCode2;
  }

  get templCode3(): string {
    return this.M.templCode3;
  }

  get templCode4(): string {
    return this.M.templCode4;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get extendStyleOnly(): boolean {
    return this.M.extendStyleOnly != null ? this.M.extendStyleOnly : false;
  }

  get replaceDefault(): boolean {
    return this.M.replaceDefault != null ? this.M.replaceDefault : false;
  }

  get runtimeObject(): boolean {
    return this.M.runtimeObject != null ? this.M.runtimeObject : false;
  }

  get cls(): string {
    return 'PSAppPFPluginRefImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.res.IPSAppPFPluginRef') return true;
    return super.instanceof(cls);
  }
}
